﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace WWB.DisqusSharp.Tests.TestUtility
{
    public static class TestSettingsProvider
    {
        private static TestSettings settings;

        public static TestSettings GetTestSettings()
        {
            if (settings == null)
            {
                if (File.Exists("user.json"))
                {
                    Debug.WriteLine("Deserializing settings from user.json.");
                    settings = JsonConvert.DeserializeObject<TestSettings>(File.ReadAllText("user.json"));
                }
                settings = settings ?? new TestSettings() {ApiKey = "DEFAULT", ForumId = "FORUM", ThreadId = "THREAD"};
            }
            return settings;
        }
    }

    public class TestSettings
    {
        public string ApiKey { get; set; }
        public string ForumId { get; set; }
        public string ThreadId { get; set; }
    }
}


